package com.centerm.common.constant.enums.document;

import com.centerm.common.constant.StatusCode;

/**
 * @author Fly
 * @Description:
 * @date 2017/7/24
 */
public enum DocumentStatus implements StatusCode{
	BLANK(0, "未提交"),
	SUBMITTED(1, "已提交"),
	;
	
	private Integer code;
	private String description;
	
	DocumentStatus(Integer code, String description) {
		this.code = code;
		this.description = description;
	}
	
	@Override
	public Integer getCode() {
		return this.code;
	}

	@Override
	public String getDescription() {
		return this.description;
	}

	public static StatusCode getByCode(Integer code) {
		for(DocumentStatus documentStatus : DocumentStatus.values()) {
            if(documentStatus.getCode().equals(code)) {
                return documentStatus;
            }
        }
        return null;
	}


	public static String getDescriptionByCode(Integer code) {
		for(DocumentStatus documentStatus : DocumentStatus.values()) {
            if(documentStatus.getCode().equals(code)) {
                return documentStatus.getDescription();
            }
        }
        return null;
	}
}
